package oop.java0317;

/**
 * 书籍有书名，出版社，作者，出版日期等信息，定义并测试书籍对象，输出书籍信息
 */
public class Test3 {
    public static void main(String[] args) {
        Book book = new Book();
        book.init("Java面向对象", "人民邮电出版社", "肖睿，崔雪伟", "2018年01月");
        book.print();
    }
}

//书类
class Book {
    //书名
    String name;
    //出版社
    String press;
    //作者
    String author;
    //出版日期
    String date;

    //初始化
    public void init(String name, String press, String author, String date) {
        this.name = name;
        this.press = press;
        this.author = author;
        this.date = date;
    }

    public void print() {
        System.out.println("书名：" + name + "\n出版社：" + press + "\n作者：" + author + "\n出版日期：" + date);
    }
}
